Integrand size = 23, antiderivative size = 59 \[ \int \frac {A+B \cot (c+d x)}{a+b \cot (c+d x)} \, dx=\frac {(a A+b B) x}{a^2+b^2}-\frac {(A b-a B) \log (b \cos (c+d x)+a \sin (c+d x))}{\left (a^2+b^2\right ) d} \]
Time = 0.18 (sec) , antiderivative size = 67, normalized size of antiderivative = 1.14 \[ \int \frac {A+B \cot (c+d x)}{a+b \cot (c+d x)} \, dx=-\frac {2 (a A+b B) \arctan (\cot (c+d x))+(A b-a B) \left (2 \log (a+b \cot (c+d x))-\log \left (\csc ^2(c+d x)\right )\right )}{2 \left (a^2+b^2\right ) d} \]
-1/2*(2*(a*A + b*B)*ArcTan[Cot[c + d*x]] + (A*b - a*B)*(2*Log[a + b*Cot[c + d*x]] - Log[Csc[c + d*x]^2]))/((a^2 + b^2)*d)
Time = 0.35 (sec) , antiderivative size = 59, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.217, Rules used = {3042, 4014, 25, 3042, 4013}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \frac {A+B \cot (c+d x)}{a+b \cot (c+d x)} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {A-B \tan \left (c+d x+\frac {\pi }{2}\right )}{a-b \tan \left (c+d x+\frac {\pi }{2}\right )}dx\) |
\(\Big \downarrow \) 4014 |
\(\displaystyle \frac {x (a A+b B)}{a^2+b^2}-\frac {(A b-a B) \int -\frac {b-a \cot (c+d x)}{a+b \cot (c+d x)}dx}{a^2+b^2}\) |
\(\Big \downarrow \) 25 |
\(\displaystyle \frac {(A b-a B) \int \frac {b-a \cot (c+d x)}{a+b \cot (c+d x)}dx}{a^2+b^2}+\frac {x (a A+b B)}{a^2+b^2}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {(A b-a B) \int \frac {b+a \tan \left (c+d x+\frac {\pi }{2}\right )}{a-b \tan \left (c+d x+\frac {\pi }{2}\right )}dx}{a^2+b^2}+\frac {x (a A+b B)}{a^2+b^2}\) |
\(\Big \downarrow \) 4013 |
\(\displaystyle \frac {x (a A+b B)}{a^2+b^2}-\frac {(A b-a B) \log (a \sin (c+d x)+b \cos (c+d x))}{d \left (a^2+b^2\right )}\) |
((a*A + b*B)*x)/(a^2 + b^2) - ((A*b - a*B)*Log[b*Cos[c + d*x] + a*Sin[c + d*x]])/((a^2 + b^2)*d)
3.1.92.3.1 Defintions of rubi rules used
Int[((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_) + (b_.)*tan[(e_.) + (f_.)* (x_)]), x_Symbol] :> Simp[(c/(b*f))*Log[RemoveContent[a*Cos[e + f*x] + b*Si n[e + f*x], x]], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && EqQ[a*c + b*d, 0]
Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_. )*(x_)]), x_Symbol] :> Simp[(a*c + b*d)*(x/(a^2 + b^2)), x] + Simp[(b*c - a *d)/(a^2 + b^2) Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && N eQ[a*c + b*d, 0]
Time = 0.08 (sec) , antiderivative size = 66, normalized size of antiderivative = 1.12
method | result | size |
parallelrisch | \(\frac {\left (-2 A b +2 B a \right ) \ln \left (a \tan \left (d x +c \right )+b \right )+\left (A b -B a \right ) \ln \left (\sec \left (d x +c \right )^{2}\right )+2 d x \left (A a +B b \right )}{2 d \left (a^{2}+b^{2}\right )}\) | \(66\) |
norman | \(\frac {\left (A a +B b \right ) x}{a^{2}+b^{2}}+\frac {\left (A b -B a \right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2 d \left (a^{2}+b^{2}\right )}-\frac {\left (A b -B a \right ) \ln \left (a \tan \left (d x +c \right )+b \right )}{d \left (a^{2}+b^{2}\right )}\) | \(86\) |
derivativedivides | \(\frac {\frac {\frac {\left (A b -B a \right ) \ln \left (\cot \left (d x +c \right )^{2}+1\right )}{2}+\left (-A a -B b \right ) \left (\frac {\pi }{2}-\operatorname {arccot}\left (\cot \left (d x +c \right )\right )\right )}{a^{2}+b^{2}}-\frac {\left (A b -B a \right ) \ln \left (a +b \cot \left (d x +c \right )\right )}{a^{2}+b^{2}}}{d}\) | \(91\) |
default | \(\frac {\frac {\frac {\left (A b -B a \right ) \ln \left (\cot \left (d x +c \right )^{2}+1\right )}{2}+\left (-A a -B b \right ) \left (\frac {\pi }{2}-\operatorname {arccot}\left (\cot \left (d x +c \right )\right )\right )}{a^{2}+b^{2}}-\frac {\left (A b -B a \right ) \ln \left (a +b \cot \left (d x +c \right )\right )}{a^{2}+b^{2}}}{d}\) | \(91\) |
risch | \(\frac {i x B}{i b +a}+\frac {x A}{i b +a}+\frac {2 i A b x}{a^{2}+b^{2}}-\frac {2 i B a x}{a^{2}+b^{2}}+\frac {2 i A b c}{d \left (a^{2}+b^{2}\right )}-\frac {2 i B a c}{d \left (a^{2}+b^{2}\right )}-\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+\frac {i b -a}{i b +a}\right ) A b}{d \left (a^{2}+b^{2}\right )}+\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+\frac {i b -a}{i b +a}\right ) B a}{d \left (a^{2}+b^{2}\right )}\) | \(179\) |
1/2*((-2*A*b+2*B*a)*ln(a*tan(d*x+c)+b)+(A*b-B*a)*ln(sec(d*x+c)^2)+2*d*x*(A *a+B*b))/d/(a^2+b^2)
Time = 0.27 (sec) , antiderivative size = 79, normalized size of antiderivative = 1.34 \[ \int \frac {A+B \cot (c+d x)}{a+b \cot (c+d x)} \, dx=\frac {2 \, {\left (A a + B b\right )} d x + {\left (B a - A b\right )} \log \left (a b \sin \left (2 \, d x + 2 \, c\right ) + \frac {1}{2} \, a^{2} + \frac {1}{2} \, b^{2} - \frac {1}{2} \, {\left (a^{2} - b^{2}\right )} \cos \left (2 \, d x + 2 \, c\right )\right )}{2 \, {\left (a^{2} + b^{2}\right )} d} \]
1/2*(2*(A*a + B*b)*d*x + (B*a - A*b)*log(a*b*sin(2*d*x + 2*c) + 1/2*a^2 + 1/2*b^2 - 1/2*(a^2 - b^2)*cos(2*d*x + 2*c)))/((a^2 + b^2)*d)
Result contains complex when optimal does not.
Time = 0.53 (sec) , antiderivative size = 524, normalized size of antiderivative = 8.88 \[ \int \frac {A+B \cot (c+d x)}{a+b \cot (c+d x)} \, dx=\begin {cases} \frac {\tilde {\infty } x \left (A + B \cot {\left (c \right )}\right )}{\cot {\left (c \right )}} & \text {for}\: a = 0 \wedge b = 0 \wedge d = 0 \\\frac {\frac {A \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + B x}{b} & \text {for}\: a = 0 \\\frac {i A d x \cot {\left (c + d x \right )}}{2 b d \cot {\left (c + d x \right )} - 2 i b d} + \frac {A d x}{2 b d \cot {\left (c + d x \right )} - 2 i b d} - \frac {i A}{2 b d \cot {\left (c + d x \right )} - 2 i b d} + \frac {B d x \cot {\left (c + d x \right )}}{2 b d \cot {\left (c + d x \right )} - 2 i b d} - \frac {i B d x}{2 b d \cot {\left (c + d x \right )} - 2 i b d} + \frac {B}{2 b d \cot {\left (c + d x \right )} - 2 i b d} & \text {for}\: a = - i b \\- \frac {i A d x \cot {\left (c + d x \right )}}{2 b d \cot {\left (c + d x \right )} + 2 i b d} + \frac {A d x}{2 b d \cot {\left (c + d x \right )} + 2 i b d} + \frac {i A}{2 b d \cot {\left (c + d x \right )} + 2 i b d} + \frac {B d x \cot {\left (c + d x \right )}}{2 b d \cot {\left (c + d x \right )} + 2 i b d} + \frac {i B d x}{2 b d \cot {\left (c + d x \right )} + 2 i b d} + \frac {B}{2 b d \cot {\left (c + d x \right )} + 2 i b d} & \text {for}\: a = i b \\\frac {x \left (A + B \cot {\left (c \right )}\right )}{a + b \cot {\left (c \right )}} & \text {for}\: d = 0 \\\frac {2 A a d x}{2 a^{2} d + 2 b^{2} d} - \frac {2 A b \log {\left (\tan {\left (c + d x \right )} + \frac {b}{a} \right )}}{2 a^{2} d + 2 b^{2} d} + \frac {A b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 a^{2} d + 2 b^{2} d} + \frac {2 B a \log {\left (\tan {\left (c + d x \right )} + \frac {b}{a} \right )}}{2 a^{2} d + 2 b^{2} d} - \frac {B a \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 a^{2} d + 2 b^{2} d} + \frac {2 B b d x}{2 a^{2} d + 2 b^{2} d} & \text {otherwise} \end {cases} \]
Piecewise((zoo*x*(A + B*cot(c))/cot(c), Eq(a, 0) & Eq(b, 0) & Eq(d, 0)), ( (A*log(tan(c + d*x)**2 + 1)/(2*d) + B*x)/b, Eq(a, 0)), (I*A*d*x*cot(c + d* x)/(2*b*d*cot(c + d*x) - 2*I*b*d) + A*d*x/(2*b*d*cot(c + d*x) - 2*I*b*d) - I*A/(2*b*d*cot(c + d*x) - 2*I*b*d) + B*d*x*cot(c + d*x)/(2*b*d*cot(c + d* x) - 2*I*b*d) - I*B*d*x/(2*b*d*cot(c + d*x) - 2*I*b*d) + B/(2*b*d*cot(c + d*x) - 2*I*b*d), Eq(a, -I*b)), (-I*A*d*x*cot(c + d*x)/(2*b*d*cot(c + d*x) + 2*I*b*d) + A*d*x/(2*b*d*cot(c + d*x) + 2*I*b*d) + I*A/(2*b*d*cot(c + d*x ) + 2*I*b*d) + B*d*x*cot(c + d*x)/(2*b*d*cot(c + d*x) + 2*I*b*d) + I*B*d*x /(2*b*d*cot(c + d*x) + 2*I*b*d) + B/(2*b*d*cot(c + d*x) + 2*I*b*d), Eq(a, I*b)), (x*(A + B*cot(c))/(a + b*cot(c)), Eq(d, 0)), (2*A*a*d*x/(2*a**2*d + 2*b**2*d) - 2*A*b*log(tan(c + d*x) + b/a)/(2*a**2*d + 2*b**2*d) + A*b*log (tan(c + d*x)**2 + 1)/(2*a**2*d + 2*b**2*d) + 2*B*a*log(tan(c + d*x) + b/a )/(2*a**2*d + 2*b**2*d) - B*a*log(tan(c + d*x)**2 + 1)/(2*a**2*d + 2*b**2* d) + 2*B*b*d*x/(2*a**2*d + 2*b**2*d), True))
Time = 0.43 (sec) , antiderivative size = 89, normalized size of antiderivative = 1.51 \[ \int \frac {A+B \cot (c+d x)}{a+b \cot (c+d x)} \, dx=\frac {\frac {2 \, {\left (A a + B b\right )} {\left (d x + c\right )}}{a^{2} + b^{2}} + \frac {2 \, {\left (B a - A b\right )} \log \left (a \tan \left (d x + c\right ) + b\right )}{a^{2} + b^{2}} - \frac {{\left (B a - A b\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{2} + b^{2}}}{2 \, d} \]
1/2*(2*(A*a + B*b)*(d*x + c)/(a^2 + b^2) + 2*(B*a - A*b)*log(a*tan(d*x + c ) + b)/(a^2 + b^2) - (B*a - A*b)*log(tan(d*x + c)^2 + 1)/(a^2 + b^2))/d
Time = 0.31 (sec) , antiderivative size = 95, normalized size of antiderivative = 1.61 \[ \int \frac {A+B \cot (c+d x)}{a+b \cot (c+d x)} \, dx=\frac {\frac {2 \, {\left (A a + B b\right )} {\left (d x + c\right )}}{a^{2} + b^{2}} - \frac {{\left (B a - A b\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{2} + b^{2}} + \frac {2 \, {\left (B a^{2} - A a b\right )} \log \left ({\left | a \tan \left (d x + c\right ) + b \right |}\right )}{a^{3} + a b^{2}}}{2 \, d} \]
1/2*(2*(A*a + B*b)*(d*x + c)/(a^2 + b^2) - (B*a - A*b)*log(tan(d*x + c)^2 + 1)/(a^2 + b^2) + 2*(B*a^2 - A*a*b)*log(abs(a*tan(d*x + c) + b))/(a^3 + a *b^2))/d
Time = 0.80 (sec) , antiderivative size = 155, normalized size of antiderivative = 2.63 \[ \int \frac {A+B \cot (c+d x)}{a+b \cot (c+d x)} \, dx=\frac {A\,\ln \left (\mathrm {cot}\left (c+d\,x\right )+1{}\mathrm {i}\right )}{2\,\left (b\,d+a\,d\,1{}\mathrm {i}\right )}-\frac {B\,\ln \left (\mathrm {cot}\left (c+d\,x\right )+1{}\mathrm {i}\right )}{2\,\left (a\,d-b\,d\,1{}\mathrm {i}\right )}-\frac {A\,b\,\ln \left (a+b\,\mathrm {cot}\left (c+d\,x\right )\right )}{d\,\left (a^2+b^2\right )}+\frac {B\,a\,\ln \left (a+b\,\mathrm {cot}\left (c+d\,x\right )\right )}{d\,\left (a^2+b^2\right )}+\frac {A\,\ln \left (\mathrm {cot}\left (c+d\,x\right )-\mathrm {i}\right )\,1{}\mathrm {i}}{2\,\left (a\,d+b\,d\,1{}\mathrm {i}\right )}-\frac {B\,\ln \left (\mathrm {cot}\left (c+d\,x\right )-\mathrm {i}\right )\,1{}\mathrm {i}}{2\,\left (-b\,d+a\,d\,1{}\mathrm {i}\right )} \]
(A*log(cot(c + d*x) - 1i)*1i)/(2*(a*d + b*d*1i)) + (A*log(cot(c + d*x) + 1 i))/(2*(a*d*1i + b*d)) - (B*log(cot(c + d*x) + 1i))/(2*(a*d - b*d*1i)) - ( B*log(cot(c + d*x) - 1i)*1i)/(2*(a*d*1i - b*d)) - (A*b*log(a + b*cot(c + d *x)))/(d*(a^2 + b^2)) + (B*a*log(a + b*cot(c + d*x)))/(d*(a^2 + b^2))